package com.klun.project.common.constans.leetcode;

import com.klun.project.common.constans.utils.ParseUtils;

import java.util.List;
import java.util.concurrent.Semaphore;


public class Solution1117 {
	public static void main(String[] args) {
		Solution1117 solution = new Solution1117();
		List<List<Integer>> arrayLists = ParseUtils.stringToIntLists("[[2],[3,4],[6,5,7],[4,1,8,3]]");
//		System.out.println(solution.rob(new int[]{2, 7, 9, 3, 1}));
//		System.out.println(solution.nthUglyNumber(10));
	}
}

class H2O {
	private Semaphore hSema = new Semaphore(2);
	private Semaphore oSema = new Semaphore(0);
	public H2O() {
	}

	public void hydrogen(Runnable releaseHydrogen) throws InterruptedException {
		hSema.acquire();
		// releaseHydrogen.run() outputs "H". Do not change or remove this line.
		releaseHydrogen.run();
		oSema.release();
	}

	public void oxygen(Runnable releaseOxygen) throws InterruptedException {
		oSema.acquire(2);
		// releaseOxygen.run() outputs "O". Do not change or remove this line.
		releaseOxygen.run();
		hSema.release(2);
	}
}

